sgdk
string.h File Reference

String manipulations. More...

Go to the source code of this file.

Functions

u32 strlen (const char *str)
 Calculate the length of a string.
s16 strcmp (const char *str1, const char *str2)
 Compare the 2 strings.
char * strclr (char *str)
 Clear a string.
char * strcpy (char *dest, const char *src)
 Copy a string.
char * strcat (char *dest, const char *src)
 Concatenate two strings.
void intToStr (s32 value, char *str, s16 minsize)
 Convert a s32 value to string.
void uintToStr (u32 value, char *str, s16 minsize)
 Convert a u32 value to string.
void intToHex (u32 value, char *str, s16 minsize)
 Convert a u32 value to hexadecimal string.
void fix32ToStr (fix32 value, char *str, s16 numdec)
 Convert a fix32 value to string.
void fix16ToStr (fix16 value, char *str, s16 numdec)
 Convert a fix16 value to string.

Detailed Description

String manipulations.

Author:
Stephane Dallongeville
Date:
08/2011

This unit provides basic null terminated string operations and type conversions.


Function Documentation

void fix16ToStr ( fix16  value,
char *  str,
s16  numdec 
)

Convert a fix16 value to string.

Parameters:
valueThe fix16 value to convert to string.
strDestination string (it must be large enough to receive result).
numdecNumber of wanted decimal.

Converts the specified fix16 value to string.

void fix32ToStr ( fix32  value,
char *  str,
s16  numdec 
)

Convert a fix32 value to string.

Parameters:
valueThe fix32 value to convert to string.
strDestination string (it must be large enough to receive result).
numdecNumber of wanted decimal.

Converts the specified fix32 value to string.

void intToHex ( u32  value,
char *  str,
s16  minsize 
)

Convert a u32 value to hexadecimal string.

Parameters:
valueThe u32 integer value to convert to hexadecimal string.
strDestination string (it must be large enough to receive result).
minsizeMinimum size of resulting string.

Converts the specified u32 value to hexadecimal string.
If resulting value is shorter than requested minsize the method prepends result with '0' character.

void intToStr ( s32  value,
char *  str,
s16  minsize 
)

Convert a s32 value to string.

Parameters:
valueThe s32 integer value to convert to string.
strDestination string (it must be large enough to receive result).
minsizeMinimum size of resulting string.

Converts the specified s32 value to string.
If resulting value is shorter than requested minsize the method prepends result with '0' character.

char* strcat ( char *  dest,
const char *  src 
)

Concatenate two strings.

Parameters:
destDestination string (it must be large enough to receive appending).
srcSource string.
Returns:
pointer on destination string.

Appends the source string to the destination string.

char* strclr ( char *  str)

Clear a string.

Parameters:
strstring to clear.
Returns:
pointer on the given string.

Clear the specified string.

s16 strcmp ( const char *  str1,
const char *  str2 
)

Compare the 2 strings.

Parameters:
str1The string we want to compare.
str2The string we want to compare.
Returns:
an integral value indicating the relationship between the strings:
A zero value indicates that both strings are equal.
A value greater than zero indicates that the first character that does not match has a greater value in str1 than in str2
A value less than zero indicates the opposite.

This function starts comparing the first character of each string.
If they are equal to each other, it continues with the following pairs until the characters differ or until a terminating null-character is reached.

char* strcpy ( char *  dest,
const char *  src 
)

Copy a string.

Parameters:
destDestination string (it must be large enough to receive the copy).
srcSource string.
Returns:
pointer on destination string.

Copies the source string to destination.

u32 strlen ( const char *  str)

Calculate the length of a string.

Parameters:
strThe string we want to calculate the length.
Returns:
length of string.

This function calculates and returns the length of the specified string.

void uintToStr ( u32  value,
char *  str,
s16  minsize 
)

Convert a u32 value to string.

Parameters:
valueThe u32 integer value to convert to string.
strDestination string (it must be large enough to receive result).
minsizeMinimum size of resulting string.

Converts the specified u32 value to string.
If resulting value is shorter than requested minsize the method prepends result with '0' character.

 All Classes Files Functions Variables Typedefs Enumerations Defines